package com.msb.mall.mallsearch.controller;

import com.msb.mall.mallsearch.service.MallSearchService;
import com.msb.mall.mallsearch.vo.SearchParamVO;
import com.msb.mall.mallsearch.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author zhangjiajun
 * @Email zhangjiajun@hydsoft.com
 * @Description
 * @Date 2025/7/28 18:12
 */
@Controller
public class SearchController {

    @Autowired
    MallSearchService mallSearchService;


    /**
     * 检索处理
     * @param param
     * @return
     */
    @GetMapping(value = {"/list.html","/", "index.html"})
    public String listPage(SearchParamVO param, Model model) {

        //根据传递过来的的条件查询数据
        SearchResult search = mallSearchService.search(param);
        model.addAttribute("result", search);

        return "index";
    }
}
